<?php

    function get_logged_user(){
        $objMySession = new MY_Session();
        $obj = class_loader::new_obj('user_m_user',NULL);
        $obj->get_by_id($objMySession->userdata('current_login_userid'));
        if($obj->exists())
            return $obj;
        else {
            return null;
        }
    }

    function is_user_logged_in(){
        $objMySession = new MY_Session();
        $user_loggedin = TRUE;
        if ($objMySession->userdata('current_login_userid') == null){
                $user_loggedin = FALSE;
        }

        return $user_loggedin;
    }

    function is_sys_user_logged_in(){
        $user = get_logged_user();
        if($user){
            if($user->is_system_user=="1"){
                return $user;
            }else{
                NULL;
            }
        }else{
            NULL;
        }
    }

    function get_guest_user_id(){
        //@TODO : not implemented yet.this should return NULL or a user_m_user beased on guest
        //user settings
        return NULL;
    }

?>
